#!/usr/bin/perl
#
use strict;
use warnings;
use Data::Dumper;
 
binmode STDOUT, ":utf8";
#use utf8;
 
use JSON;
require "doa_subs.pl";
use File::Copy;
use CGI;
use lib '.';
use users;

my ($username,$level) = &validate;


############################## Main Prog ##############################
#
# This program will process all files in the mapdata directory
# Creating/updating mapfile.json with up-to-date player details
#
# terrain:{256,646":[900340313,"Brelm",0,1,0,-1],"256,657":[900366906,"Skyrim",0,1,0,-1]}
# players:{"900315223":[0,4,0,37527,"The Spreading Death",0],"900315225":[0,2,0,5020,0,0]}
#
my $q = new CGI;

print $q->header;
print $q->start_html(
	-title => "Access log file viewer"
);

print $q->h1("Access Log file viewer");

open(INFO, "/var/log/apache2/access.log") or die_nice("can't open access logfile file to read $!");

foreach my $line (<INFO>)  {   
    print $q->p($line);    
}
close(INFO);

print $q->br();
print $q->a( {-href=>"menu.cgi"}, "Main Menu");
print $q->end_html;
